package org.example.Thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:Lenovo
 * Date:2022-03-21
 * Time:12:44
 */
public class Demo8 {
    public static void main(String[] args) {
        java.lang.Thread t1 = new java.lang.Thread(() ->{
            while (true){
                System.out.println("hello thread1");
                try {
                    java.lang.Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"ThreadT1");
        t1.start();
        java.lang.Thread t2 = new java.lang.Thread(() ->{
            while (true){
                System.out.println("hello thread2");
                try {
                    java.lang.Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"ThreadT2");
        t2.start();
    }
}
